package com.tensquare.base.exception;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * & ProjectName：  tensquare-parent
 * & PackageName:   com.tensquare.base.exception
 * & Creation_Date： 2020/3/30 07:01
 * & Author：しの
 * ----------------------------------
 * & Description:   配置springboot的全局异常处理
 */
@ControllerAdvice
public class BaseExceptionHandler {

    @ExceptionHandler(Exception.class)
    @RequestMapping
    public Result error(Exception e){
        e.printStackTrace();
        return new Result(false,StatusCode.ERROR,e.getMessage());
    }
}
